import { reactive, watch } from 'vue'
import deepCopy from '../composables/deepCopy'
import type { AddOrUpdateUser } from '@/api/patient/type'
import { storeToRefs } from 'pinia'
import { useClientStore } from '@/store/modules/clientStore'
const clientStore = useClientStore()
export const { ofPatient } = storeToRefs(clientStore)

export const queryInfo = reactive<AddOrUpdateUser>({
  name: '', // 用户姓名
  certificatesType: '', // 用户证件类型
  certificatesNo: '', // 用户证件号码
  sex: 0, // 用户性别
  birthdate: '', // 用户出生日期
  phone: '', // 用户手机号码
  isMarry: 0, // 用户婚姻状况
  isInsure: 0, // 自费/医保
  addressSelected: [], // 用户当前住址
  address: '', //用户详细地址
  contactsName: '', // 联系人姓名
  contactsCertificatesType: '', // 联系人证件类型
  contactsCertificatesNo: '', //联系人证件号码
  contactsPhone: '', // 联系人手机号
})

watch(ofPatient, () => {
  deepCopy(ofPatient.value, queryInfo)
})
